package com.job.tencent;

import java.sql.SQLOutput;
import java.util.Arrays;
import java.util.Scanner;

/**
 * @ClassName: test.Tencent1
 * @Description:
 * @Author: 12071
 * @Date: 2022/4/24 20:02
 */
public class Tencent1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        sc.nextLine();
        char[][] inputs = new char[n][];
        for (int i = 0; i < n; i++) {
            inputs[i] = sc.nextLine().toCharArray();
        }
        int m = inputs[0].length;
        int[] nums = new int[m];
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                nums[i] = nums[i]*10+(inputs[j][i]-'0');
            }
        }
        Arrays.sort(nums);
        System.out.print(nums[0]);
        for (int i = 1; i < nums.length; i++) {
            System.out.print(" "+ nums[i]);
        }
    }
}
